/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package GUI;


import java.io.File;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.image.ImageConsumer;
import java.awt.image.ImageProducer;
import javax.swing.JComponent;
/**
 *
 * @author David
 */
public class DibujaPlanetaActual extends JComponent{

    private static final long serialVersionUID = 1L;

    private int numPlaneta;
    
    public DibujaPlanetaActual(int nP){
        this.numPlaneta=nP;

       
    }
    public void paintComponent(Graphics g)
    {
        super.paintComponent(g);
        //setG(g);
        dibujaPActual(g);
    }

    public void dibujaPActual(Graphics g) {
        g.setColor(Color.RED);
        //setG(g);
        Punto posicion=this.NumPlanetaToPunto(this.numPlaneta);
       g.fillOval(posicion.getX(),posicion.getY(), 20, 20);

        
    }


    
    private Punto NumPlanetaToPunto(int nP)
    {
       int x=0;
       int y=0;
       int columna=nP % 19;
       switch (columna)
       {
           case 1: x=40; 
                break;
           case 2: x=80;
                break;
           case 3: x=120;
                break;
           case 4: x=160;
                break;
           case 5: x=200;
                break;
           case 6: x=240;
                break;
           case 7: x=280;
                break;
           case 8: x=320;
                break;
           case 9: x=360;
                break;
           case 10: x=400;
                break;
           case 11: x=440;
                break;
           case 12: x=480;
                break;   
           case 13: x=520;
                break;
           case 14: x=560;
                break;
           case 15: x=600;
                break;
           case 16: x=640;
                break;
           case 17: x=680;
                break;
           case 18: x=720;
                break;
           case 0: x=760;
                break;     
       }
        
       if(nP>=1 && nP<=19)
          y=10;
       else if(nP>=20 && nP<=38)
               y=50;
            else if(nP>=39 && nP<=57)
                    y=90;
                else if(nP>=58 && nP<=76)
                        y=130;
                    else if(nP>=77 && nP<=95)
                             y=170;
                        else if(nP>=96 && nP<=114)
                                y=210;
                            else if(nP>=115 && nP<=133)
                                    y=250;
                                else if(nP>=134 && nP<=152)
                                        y=290;
                                    else if(nP>=153 && nP<=171)
                                            y=330;
                                        else if(nP>=172 && nP<=190)
                                                y=370;
                                            else if(nP>=191 && nP<=209)
                                                    y=410;
                                                else if(nP>=210 && nP<=228)
                                                        y=450;
                                                     else if(nP>=229 && nP<=247)
                                                              y=490;
                                                     
       return new Punto(x,y);
       
    }
   
}
